import HttpRequest from "@/lib/axios.js";

class UserModel extends HttpRequest {
  constructor() {
    super();
  }
  /* 发送验证码接口 */
  _sendTextCode({ mobile }) {
    return this.req({
      url: "user/sendTextCode",
      method: "post",
      data: {
        mobile
      }
    });
  }
  /* 用户注册接口 */
  _doSignup({
    mobile,
    password,
    text_code,
    realname,
    bank,
    bankcard,
    receiver_address,
    receiver_area_name
  }) {
    return this.req({
      url: "user/doSignup",
      method: "post",
      data: {
        mobile,
        password,
        text_code,
        realname,
        bank,
        bankcard,
        receiver_address,
        receiver_area_name
      }
    });
  }
  /* 修改密码 */
  _resetPassword({ mobile, text_code, password }) {
    return this.req({
      url: "user/resetPassword",
      method: "post",
      data: {
        mobile,
        text_code,
        password
      }
    });
  }
  /* 获取用户会员信息 */
  _getUserInfo() {
    return this.req({
      url: "user/getUserInfo"
    });
  }
  /* 修改用户会员信息 */
  _updateUserInfo({
    realname = "",
    receiver_address = "",
    receiver_area_name = "",
    id_card = "",
    bank = "",
    bankcard = "",
    parent_number = ""
  }) {
    return this.req({
      url: "user/updateUserInfo",
      method: "post",
      data: {
        realname,
        receiver_address,
        receiver_area_name,
        id_card,
        bank,
        bankcard,
        parent_number
      }
    });
  }
  /* 获取累计董事分红 */
  _getTotalAgentEarn() {
    return this.req({
      url: "account/getTotalAgentEarn"
    });
  }
  /* 获取累计区域分红 */
  _getTotalAreaAgentEarn() {
    return this.req({
      url: "account/getTotalAreaAgentEarn"
    });
  }
  /* 获取账户流水列表 */
  _getAccountFlowList({ name, curpage = 1, pagesize = 9999 }) {
    return this.req({
      url: "account/getAccountFlowList",
      method: "post",
      data: {
        name,
        curpage,
        pagesize
      }
    });
  }
  /* 获取提现信息 */
  _getWithdrawInfo() {
    return this.req({
      url: "account/getWithdrawInfo"
    });
  }
  /* 提现接口 */
  _doWithdraw({ amount, bank, bankcard }) {
    return this.req({
      url: "account/doWithdraw",
      method: "post",
      data: {
        amount,
        bank,
        bankcard
      }
    });
  }
  /* 会员中心接口 */
  _getUserCenterInfo() {
    return this.req({
      url: "account/getUserCenterInfo"
    });
  }
  /* 用户登录接口 */
  _doLogin({ mobile, password }) {
    return this.req({
      url: "user/doLogin",
      method: "post",
      data: {
        mobile,
        password
      }
    });
  }
  /* 退出登录接口 */
  _logout() {
    return this.req({
      url: "user/logout"
    });
  }
  /* 获取提现列表 */
  _getWithdrawList({ curpage = 1, pagesize = 9999, status }) {
    return this.req({
      url: "account/getWithdrawList",
      method: "post",
      data: {
        curpage,
        pagesize,
        status
      }
    });
  }
  /* 获取董事中心接口 */
  _getAgentCenterInfo() {
    return this.req({
      url: "agent/getAgentCenterInfo"
    });
  }
}

export default UserModel;
